#include <iostream>
using namespace std;

int month_28[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int mon, day;

int main()
{
    int w;
    cin >> w;
    mon = day = 1;
    for (int i = 1; i <= 365; i++)
    {
        if (day == 13 && w == 5)
        {
            printf("%d\n", mon);
        }
        w += 1;
        if (w > 7)
            w = 1;
        day++;
        if (day > month_28[mon - 1])
        {
            day = 1;
            mon += 1;
        }
    }
    return 0;
}